Page({
  data: {
    xh: ''
  },
  onLoad: function () {
    var xh = wx.getStorageSync("xh");
    if (xh.length === 10) {
      qq.getStorage({
        key: 'home',
        success(res) {
          console.log(res)
          if (res.data) {
            // qq.switchTab({
            //   url: '/pages/core/table/index'
            // })
            qq.reLaunch({
              url: "/pages/core/table/index"
            })
          } else {
            // qq.switchTab({
            //   url: '/pages/index/index'
            // })
            qq.reLaunch({
              url: "/pages/index/index"
            })
          }
        }, fail(res) {
          console.log(res)
          qq.reLaunch({
              url: "/pages/index/index"
            })
        }
      })

    }
  },
  onShareAppMessage: function () {
    return {
      title: "邀您体验",
      desc: "「工程课表」提供工程职院在校生师生课表等查询服务。",
      path: "/pages/index/index"
    }
  },
  guize: function () {
    qq.navigateTo({
      url: "/pages/more/about"
    })
  },
  xhInput: function (t) {
    this.data.xh = t.detail.value
  },
  setxh: function () {
    this.data.xh.length < 10 ? qq.showModal({
      content: "请提交正确的学号~",
      showCancel: !1
    }) : (qq.setStorageSync("xh", this.data.xh), wx.showToast({
      title: "设置成功",
      icon: "success"
    }), qq.reLaunch({
      url: "/pages/index/index"
    }))
  }
})